import request from '@/utils/request'
import Qs from 'qs'

export function listOrder(query) {
  return request({
    url: '/mms/v1/orders/manage/list',
    method: 'get',
    params: query,
    paramsSerializer: function(params) {
      return Qs.stringify(params, { arrayFormat: 'repeat' })
    }
  })
}

export function detailOrder(id) {
  return request({
    url: `/mms/v1/orders/detail/${id}`,
    method: 'get'
  })
}

export function shipOrder(data) {
  // 发货
  return request({
    url: '/mms/v1/orders/manage/delivery',
    method: 'post',
    data
  })
}

export function refundOrder(data) {
  return request({
    url: '/order/refund',
    method: 'post',
    data
  })
}

export function getDeliveryOrders(data) {
  // 通过退款
  return request({
    url: `/mms/v1/orders/manage/delivery/info/${data.orderNo}`,
    method: 'get'
  })
}

export function passComment(data) {
  // 通过退款
  return request({
    url: `/mms/v1/return/apply/update/status/${data.id}`,
    method: 'post',
    data
  })
}
